using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Mgh.Data.Sql;
using Jewelry.BussinessLayer;
using System.Collections.Generic;

public partial class Pages_AManageFeature : Mgh.UI.Sql.PageBase
{
    #region properties

    private ProductBLL bn;

    #endregion

    #region events

    override protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
    }

    protected void odsCateCreating(object sender, ObjectDataSourceEventArgs e)
    {
        bn = new ProductBLL(getCurrentConnect());
        e.ObjectInstance = bn;
    }

    protected void odsCateSelected(object sender, ObjectDataSourceStatusEventArgs e)
    {
        if (e.ReturnValue == null)
        {
            cval.IsValid = false;
            cval.Text = bn.getMessage();
        }
    }

    protected void executeCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals(e.CommandName))
            Response.Redirect("AEditFeature.aspx?feid=" + e.CommandArgument.ToString());
    }

    protected void clickAdd(object sender, EventArgs e)
    {
        Response.Redirect("AEditFeature.aspx");
    }

    protected void clickDelete(object sender, EventArgs e)
    {
        HtmlInputCheckBox ck = new HtmlInputCheckBox();
        List<object> lis = new List<object>();
        ProductBLL bn = new ProductBLL(getCurrentConnect());
        foreach (GridViewRow row in gv.Rows)
        {
            ck = row.FindControl("ckMember") as HtmlInputCheckBox;
            if (ck.Checked)
            {
                lis.Add(gv.DataKeys[row.DataItemIndex].Value.ToString());
            }
        }
        if (bn.delFeatures(lis))
        {
            gv.DataBind();
        }
        else
        {
            cval.IsValid = false;
            cval.Text = bn.getMessage();
        }
    }

    #endregion
}
